package cn.jane.bigevent.util;

import java.util.Map;

public class ThreadLocalUtil {

    private static final ThreadLocal<Map<String, Object>> THREAD_LOCAL = new ThreadLocal<>();

    public static int getUserId() {
        return (Integer) THREAD_LOCAL.get().get("id");
    }

    public static String getUsername() {
        return (String) THREAD_LOCAL.get().get("username");
    }

    public static void set(Map<String, Object> claims) {
        THREAD_LOCAL.set(claims);
    }

    public static void remove() {
        THREAD_LOCAL.remove();
    }
}
